home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / Universal Headers 2.0.1f / Processes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-22  |  5.4 KB  |  189 lines  |  [TEXT/MMCC]

  1. /*
  2.      File:        Processes.h
  3.  
  4.      Contains:    Process Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __PROCESSES__
  21. #define __PROCESSES__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __EVENTS__
  30. #include <Events.h>
  31. #endif
  32. /*    #include <Quickdraw.h>                                        */
  33. /*        #include <MixedMode.h>                                    */
  34. /*        #include <QuickdrawText.h>                                */
  35. /*    #include <OSUtils.h>                                        */
  36. /*        #include <Memory.h>                                        */
  37.  
  38. #ifndef __FILES__
  39. #include <Files.h>
  40. #endif
  41.  
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45.  
  46. #if PRAGMA_ALIGN_SUPPORTED
  47. #pragma options align=mac68k
  48. #endif
  49.  
  50. #if PRAGMA_IMPORT_SUPPORTED
  51. #pragma import on
  52. #endif
  53.  
  54. struct ProcessSerialNumber {
  55.     unsigned long                    highLongOfPSN;
  56.     unsigned long                    lowLongOfPSN;
  57. };
  58. typedef struct ProcessSerialNumber ProcessSerialNumber, *ProcessSerialNumberPtr;
  59.  
  60.  
  61. enum {
  62. /* Process identifier - Various reserved process serial numbers */
  63.     kNoProcess                    = 0,
  64.     kSystemProcess                = 1,
  65.     kCurrentProcess                = 2
  66. };
  67.  
  68. /* Definition of the parameter block passed to _Launch
  69.     Typedef and flags for launchControlFlags field */
  70. typedef unsigned short LaunchFlags;
  71.  
  72.  
  73. enum {
  74. /* Definition of the parameter block passed to _Launch */
  75.     launchContinue                = 0x4000,
  76.     launchNoFileFlags            = 0x0800,
  77.     launchUseMinimum            = 0x0400,
  78.     launchDontSwitch            = 0x0200,
  79.     launchAllow24Bit            = 0x0100,
  80.     launchInhibitDaemon            = 0x0080
  81. };
  82.  
  83. /* Format for first AppleEvent to pass to new process.  The size of the overall
  84.   buffer variable: the message body immediately follows the messageLength */
  85. struct AppParameters {
  86.     EventRecord                        theMsgEvent;
  87.     unsigned long                    eventRefCon;
  88.     unsigned long                    messageLength;
  89. };
  90. typedef struct AppParameters AppParameters, *AppParametersPtr;
  91.  
  92. /* Parameter block to _Launch */
  93. struct LaunchParamBlockRec {
  94.     unsigned long                    reserved1;
  95.     unsigned short                    reserved2;
  96.     unsigned short                    launchBlockID;
  97.     unsigned long                    launchEPBLength;
  98.     unsigned short                    launchFileFlags;
  99.     LaunchFlags                        launchControlFlags;
  100.     FSSpecPtr                        launchAppSpec;
  101.     ProcessSerialNumber                launchProcessSN;
  102.     unsigned long                    launchPreferredSize;
  103.     unsigned long                    launchMinimumSize;
  104.     unsigned long                    launchAvailableSize;
  105.     AppParametersPtr                launchAppParameters;
  106. };
  107. typedef struct LaunchParamBlockRec LaunchParamBlockRec, *LaunchPBPtr;
  108.  
  109. /* Set launchBlockID to extendedBlock to specify that extensions exist.
  110.  Set launchEPBLength to extendedBlockLen for compatibility.*/
  111.  
  112. enum {
  113.     extendedBlock                = ((unsigned)'LC'),
  114.     extendedBlockLen            = (sizeof(LaunchParamBlockRec) - 12)
  115. };
  116.  
  117. enum {
  118. /* Definition of the information block returned by GetProcessInformation */
  119.     modeDeskAccessory            = 0x00020000,
  120.     modeMultiLaunch                = 0x00010000,
  121.     modeNeedSuspendResume        = 0x00004000,
  122.     modeCanBackground            = 0x00001000,
  123.     modeDoesActivateOnFGSwitch    = 0x00000800,
  124.     modeOnlyBackground            = 0x00000400,
  125.     modeGetFrontClicks            = 0x00000200,
  126.     modeGetAppDiedMsg            = 0x00000100,
  127.     mode32BitCompatible            = 0x00000080,
  128.     modeHighLevelEventAware        = 0x00000040,
  129.     modeLocalAndRemoteHLEvents    = 0x00000020,
  130.     modeStationeryAware            = 0x00000010,
  131.     modeUseTextEditServices        = 0x00000008,
  132.     modeDisplayManagerAware        = 0x00000004
  133. };
  134.  
  135. /* Record returned by GetProcessInformation */
  136. struct ProcessInfoRec {
  137.     unsigned long                    processInfoLength;
  138.     StringPtr                        processName;
  139.     ProcessSerialNumber                processNumber;
  140.     unsigned long                    processType;
  141.     OSType                            processSignature;
  142.     unsigned long                    processMode;
  143.     Ptr                                processLocation;
  144.     unsigned long                    processSize;
  145.     unsigned long                    processFreeMem;
  146.     ProcessSerialNumber                processLauncher;
  147.     unsigned long                    processLaunchDate;
  148.     unsigned long                    processActiveTime;
  149.     FSSpecPtr                        processAppSpec;
  150. };
  151. typedef struct ProcessInfoRec ProcessInfoRec, *ProcessInfoRecPtr;
  152.  
  153.  
  154. #if !GENERATINGCFM
  155. #pragma parameter __D0 LaunchApplication(__A0)
  156. #endif
  157. extern pascal OSErr LaunchApplication(LaunchPBPtr LaunchParams)
  158.  ONEWORDINLINE(0xA9F2);
  159. extern pascal OSErr LaunchDeskAccessory(const FSSpec *pFileSpec, ConstStr255Param pDAName)
  160.  THREEWORDINLINE(0x3F3C, 0x0036, 0xA88F);
  161. extern pascal OSErr GetCurrentProcess(ProcessSerialNumber *PSN)
  162.  THREEWORDINLINE(0x3F3C, 0x0037, 0xA88F);
  163. extern pascal OSErr GetFrontProcess(ProcessSerialNumber *PSN)
  164.  FIVEWORDINLINE(0x70FF, 0x2F00, 0x3F3C, 0x0039, 0xA88F);
  165. extern pascal OSErr GetNextProcess(ProcessSerialNumber *PSN)
  166.  THREEWORDINLINE(0x3F3C, 0x0038, 0xA88F);
  167. extern pascal OSErr GetProcessInformation(const ProcessSerialNumber *PSN, ProcessInfoRec *info)
  168.  THREEWORDINLINE(0x3F3C, 0x003A, 0xA88F);
  169. extern pascal OSErr SetFrontProcess(const ProcessSerialNumber *PSN)
  170.  THREEWORDINLINE(0x3F3C, 0x003B, 0xA88F);
  171. extern pascal OSErr WakeUpProcess(const ProcessSerialNumber *PSN)
  172.  THREEWORDINLINE(0x3F3C, 0x003C, 0xA88F);
  173. extern pascal OSErr SameProcess(const ProcessSerialNumber *PSN1, const ProcessSerialNumber *PSN2, Boolean *result)
  174.  THREEWORDINLINE(0x3F3C, 0x003D, 0xA88F);
  175.  
  176. #if PRAGMA_IMPORT_SUPPORTED
  177. #pragma import off
  178. #endif
  179.  
  180. #if PRAGMA_ALIGN_SUPPORTED
  181. #pragma options align=reset
  182. #endif
  183.  
  184. #ifdef __cplusplus
  185. }
  186. #endif
  187.  
  188. #endif /* __PROCESSES__ */
  189.